package section8;
class Person8_2{
    private String name;
    private int age;
    public Person8_2(){
        System.out.println("调用了person类无参数的构造方法！");
    }
    public Person8_2(String name,int age){
        this.age=age;
        this.name=name;
    }
    public void show(){
        System.out.println("姓名："+name+"  年龄："+age);
    }
}
class Student8_2 extends Person8_2{
    private String department;
    public Student8_2(){
        System.out.println("调用学生类的无参构造方法Student8_2()!");
    }
    public Student8_2(String name,int age,String dep){
        super(name, age);
        department=dep;
        System.out.println("我是"+department+"的学生！");
        System.out.println("调用了学生类的有参构造方法Student8_2(String name,int age,String dep)!");
    }
}
public class App8_2 {
    public static void main(String[] args) {
        Student8_2 stu1=new Student8_2();
        Student8_2 stu2=new Student8_2("李晓玲",23,"电子信息系");
        stu1.show();
        stu2.show();
    }
}
